package com.yl.core.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;

@Slf4j
public class MyApplicationStartedListener implements ApplicationListener<ApplicationStartedEvent> {

    /**
     * springboot启动开始的时候执行的事件
     * @param event
     */
    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {

        //log.error("springboot启动开始的时候执行的事件【ApplicationStartedEvent】");
        System.out.println("ApplicationStartedEvent事件发布：" + event.getTimestamp());
        //MyApplicationEvent myEvent = new MyApplicationEvent("myEvent");
        //myEvent.setMsg("我自定义了一个事件");
        //event.getApplicationContext().publishEvent(myEvent);

    }
}
